﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using SwenAssigment.Classes;
namespace SwenAssigment
{
    public partial class RoomDetail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack & Request.QueryString["roomid"] != null)
            {
                if (Label1.Text == "Label")
                {
                    string line = "select * from room where Room_ID='" + Request.QueryString["roomid"] + "'";
                    RADcon con = new RADcon();
                    string[] s = con.raretrieveone(line);
                    Label1.Text = s[0];
                    Label2.Text = s[1];
                    Label3.Text = s[2];
                    Label4.Text = s[3];
                    Label5.Text = s[4];
                    Session["rarid"] = s[0];
                    if (Label5.Text == "Vacant")
                    {
                        //Button5.Visible = false;
                    }
                    else
                    {
                        Button3.Visible = false;
                        Button4.Visible = false;
                        if (Label5.Text == "Occupied")
                        {
                            Button5.Visible = false;
                        }
                    }
                    if (Page.Request.UrlReferrer.LocalPath == "/RoomAvalibility.aspx")
                    {

                    }
                    else
                    {
                        Response.Redirect("RoomAvalibility.aspx");
                    }
                }
            }
            else
            {
                Response.Redirect("RoomAvalibility.aspx");
            }
        }
    }
}